home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Power 1997 December
/
MACPOWER-1997-12.ISO.7z
/
MACPOWER-1997-12.ISO
/
MacPowerオリジナル
/
Edutainment World
/
チャンプジム for DEMO
/
DIR
/
DataAccess.cst
/
00003_Script_FileSub Script
< prev
next >
Wrap
Text File
|
1997-09-29
|
21KB
|
851 lines
--'97.8.7 10:00 Update
global gWorkTable
global gTraningArry1 --ノ~ノbノgëシヌø
global gTraningArry2 --ノpノìノ`ノìノOノ{ナ[ノã
global gTraningArry3 --ノTノìノhノoノbノO
global gTraningArry4 --ノ酣[ノhノ霰[ノN
global gTraningArry5 --ノXノLノbノsノìノO
global gTraningArry6 --ノVノノノhノE
on test2
set fname = CDpath() & "MASTER_1"
set res = fcOpenR(fname)
if res <> 0 then
alert "ノ}ノXノ^ナ[ノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set gWorkTable = fcRead()
fcClose()
end
--*****************************************************
--ナ@ナ@íP袁ノtノ@ノCノ胝コ醯êィ
--************************
on GetFIleName user,country,traning
set fname = ""
set fname = NumToChar(user+48)
set fname = fname & GetCountryNo(country)
set fname = fname &NumToChar(traning+48)
return path() & "USER" & string(user) & delimita() & fname
end
--*****************************************************
--ナ@ナ@ノJノìノgノ菁[î醍ワ鯡ì貲iïð鴕óメヌミヌオヌï舵ンナj
--************************
on GetCountryNo country
if stringP(country) then
case country of
"JPN": set rbuf = "1"
"CHI": set rbuf = "2"
"IND": set rbuf = "3"
"SPN": set rbuf = "4"
"AUS": set rbuf = "5"
"USA": set rbuf = "6"
"TRE": set rbuf = "9"
end case
else
set rbuf = string(country)
end if
return rbuf
end
--*****************************************************
--ナ@ナ@ノfノ菲~ノ^鯡ìæ
--************************
on delimita
if the machineType = 256 then
set rbuf="¥" --Windows
else
set rbuf=":" --Macintosh
end if
return rbuf
end
--*****************************************************
--ナ@ナ@ノpノX鯡ìæ
--************************
on path
global HomePath
set rbuf = HomePath & "DATA" & delimita()
return rbuf
end
--*****************************************************
--ナ@ナ@ヌbヌcナ|ヌqヌnヌlノpノX鯡ìæ
--************************
on CDpath
return the pathName
end
--*****************************************************
-- ノ}ノXノ^ナ[腴ヌ
--****************************
on OpenMaster
set fname = CDpath() & "MASTER_" & string(1)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノ}ノXノ^ナ[ノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set gWorkTable = fcRead()
fcClose()
repeat with i=2 to 6
set fname = CDpath() & "MASTER_" & string(i)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノ}ノXノ^ナ[ノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set gWorkTable = gWorkTable & numToChar(13) & fcRead()
fcClose()
end repeat
end
--*****************************************************
-- íP袁ノ菲Xノg醯êィ
--****************************
on CreateWords user
puppetSprite 43,true
global count
set count = 0
UpdateRandomSeed()
repeat with c=1 to 6
TraningInit(c)
DataWrite(user,c,1)
DefaultRes(user,c,1,count(gTraningArry1)/3)
DataWrite(user,c,2)
DefaultRes(user,c,2,count(gTraningArry2)/4)
DataWrite(user,c,3)
DefaultRes(user,c,3,count(gTraningArry3)/4)
DataWrite(user,c,4)
DefaultRes(user,c,4,count(gTraningArry4)/5)
DataWrite(user,c,5)
DefaultRes(user,c,5,count(gTraningArry5)/4)
DataWrite(user,c,6)
DefaultRes(user,c,6,count(gTraningArry6)/4)
progress
end repeat
end
--*****************************************************
--ナ@ナ@ノgノ蠻[ノjノìノOï ëニêエノ菲Xノg醯êィ
--************************************
on TraningInit no
set the itemDelimiter = numtoChar(9)
set fname = CDpath() & "MASTER_" & string(no)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノ}ノXノ^ナ[ノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set gWorkTable = fcRead()
fcClose()
set gTraningArry1 = []
set gTraningArry2 = []
set gTraningArry3 = []
set gTraningArry4 = []
set gTraningArry5 = []
set gTraningArry6 = []
set warry1 = [:]
set warry2 = [:]
set warry3 = [:]
set warry4 = [:]
set warry5 = [:]
set warry6 = [:]
set lineno = 1
set work = ""
set tblno = random(6)
repeat while 1
global count
set count = count+1
if (count mod 4) = 0 then progress
set linecnt = the number of lines in gWorkTable
set wline = random(linecnt)
set flagbuf = item 8 of line wline of gWorkTable
set arry = []
if char 1 of flagbuf = "1" then add arry,1
if char 2 of flagbuf = "1" then add arry,2
if char 3 of flagbuf = "1" then add arry,3
if char 4 of flagbuf = "1" then add arry,4
if char 5 of flagbuf = "1" then add arry,5
if char 6 of flagbuf = "1" then add arry,6
set pos = getAt(arry,1)
case pos of
1: set throw1 = count(warry1)
set tblno = 1
2: set throw1 = count(warry2)
set tblno = 2
3: set throw1 = count(warry3)
set tblnos = 3
4: set throw1 = count(warry4)
set tblno = 4
5: set throw1 = count(warry5)
set tblno = 5
6: set throw1 = count(warry6)
set tblno = 6
end case
repeat with j = 2 to count(arry)
set pos = getAt(arry,j)
case pos of
1: set throw2 = count(warry1)
set tblno2 = 1
2: set throw2 = count(warry2)
set tblno2 = 2
3: set throw2 = count(warry3)
set tblno2 = 3
4: set throw2 = count(warry4)
set tblno2 = 4
5: set throw2 = count(warry5)
set tblno2 = 5
6: set throw2 = count(warry6)
set tblno2 = 6
end case
if throw1 > throw2 then
set throw1 = throw2
set tblno = tblno2
end if
end repeat
case tblno of
1: addProp warry1,item 2 of line wline of gWorkTable,lineno
2: addProp warry2,item 2 of line wline of gWorkTable,lineno
3: addProp warry3,item 2 of line wline of gWorkTable,lineno
4: addProp warry4,item 2 of line wline of gWorkTable,lineno
5: addProp warry5,item 2 of line wline of gWorkTable,lineno
6: addProp warry6,item 2 of line wline of gWorkTable,lineno
end case
set work = work & line wline of gWorkTable & numToChar(13)
if linecnt = 1 then exit repeat
delete line wline of gWorkTable
set lineno = lineno + 1
end repeat
set gWorkTable = work
sort(warry1)
repeat with i=1 to count(warry1)
DevideWord(1,getAt(warry1,i))
end repeat
sort(warry2)
repeat with i=1 to count(warry2)
DevideWord(2,getAt(warry2,i))
end repeat
sort(warry3)
repeat with i=1 to count(warry3)
DevideWord(3,getAt(warry3,i))
end repeat
sort(warry4)
repeat with i=1 to count(warry4)
DevideWord(4,getAt(warry4,i))
end repeat
sort(warry5)
repeat with i=1 to count(warry5)
DevideWord(5,getAt(warry5,i))
end repeat
sort(warry6)
repeat with i=1 to count(warry6)
DevideWord(6,getAt(warry6,i))
end repeat
end
--*****************************************************
-- ノfナ[ノ^齏ヌエ鍄ヌ
--****************************
on DataWrite user,country,traning
set fname = GetFIleName(user,country,traning)
set res = fcOpen(fname)
if res <> 0 then
alert "ノIナ[ノvノìノGノ簀["
exit
end if
case traning of
1: set res = fcWrite(ArryToString(gTraningArry1))
2: set res = fcWrite(ArryToString(gTraningArry2))
3: set res = fcWrite(ArryToString(gTraningArry3))
4: set res = fcWrite(ArryToString(gTraningArry4))
5: set res = fcWrite(ArryToString(gTraningArry5))
6: set res = fcWrite(ArryToString(gTraningArry6))
end case
fcClose()
end
--****************************
-- ñろヒêîî壊カ
--****************
on Qratio cnt
set arry = []
add arry,integer(cnt * 0.12)
add arry,integer(cnt * 0.13)
add arry,integer(cnt * 0.15)
add arry,integer(cnt * 0.18)
add arry,integer(cnt * 0.20)
set total = 0
repeat with i=1 to 5
set total = total + getAt(arry,i)
end repeat
add arry,(cnt - total)
return arry
end
--*****************************************************
-- íP袁ï夘リ
--****************************
on DevideWord traning,wline
case traning of
1:
add gTraningArry1,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry1,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry1,item 2 of line wline of gWorkTable --ノXノyノã
2:
add gTraningArry2,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry2,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry2,item 2 of line wline of gWorkTable --ノXノyノã
add gTraningArry2,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
3:
add gTraningArry3,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry3,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry3,item 2 of line wline of gWorkTable --ノXノyノã
set buf = item 4 of line wline of gWorkTable
set buf = buf & "," & item 5 of line wline of gWorkTable
set buf = buf & "," & item 6 of line wline of gWorkTable
add gTraningArry3,buf --ノAノNノZノìノg燿íu
4:
add gTraningArry4,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry4,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry4,item 2 of line wline of gWorkTable --ノXノyノã
add gTraningArry4,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
add gTraningArry4,item 9 of line wline of gWorkTable --苟犢ヌ「ópíP袁
5:
add gTraningArry5,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry5,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry5,item 2 of line wline of gWorkTable --ノXノyノã
add gTraningArry5,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
6:
add gTraningArry6,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add gTraningArry6,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add gTraningArry6,item 2 of line wline of gWorkTable --ノXノyノã
add gTraningArry6,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
end case
end
--*****************************************************
-- 裙笄ノtノ@ノCノ肛粭イ筱
--****************************
on DefaultRes user,country,traning,listmax
set arry = []
repeat with i=1 to listmax
add arry,"3"
end repeat
set fname = GetFIleName(user,country,traning) & "RES"
set res = fcOpen(fname)
if res <> 0 then
alert "ノIナ[ノvノìノGノ簀["
exit
end if
set res = fcWrite(ArryToString(arry))
fcClose()
end
--*****************************************************
--ナ@ナ@犇ヌ「ノgノ蠻[ノjノìノOノ菲Xノg醯êィナiノ酣[ノhノ霰[ノNナj
--************************************************
on GetBadRoadworkWords user,country
set arry =[]
set fname = GetFIleName(user,country,4) & "BAD"
set res = fcOpenR(fname)
if res <> 0 then
return arry
exit
end if
set arry = StringToArry(fcRead())
fcClose()
return arry
end
--*****************************************************
--ナ@ナ@犇ヌ「ノgノ蠻[ノjノìノOノ菲Xノg醯êィナiノXノLノbノsノìノOナj
--************************************************
on GetBadSkippingWords user,country
put the timer
set the itemDelimiter = numtoChar(9)
OpenMaster()
set cnt = the number of lines in gWorkTable
set gTraningArry5 = []
repeat with i=1 to cnt
if char 5 of item 8 of line i of gWorkTable = "1" then
add gTraningArry5,i
end if
end repeat
set fname = GetFIleName(user,country,5)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノgノ蠻[ノjノìノOノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set traning = fcRead()
fcClose()
set arry1 = []
set linecnt = the number of lines in traning / 4
set cnt = 1
repeat while 1
set pos = (cnt-1) * 4 + 3
set qword = line pos of traning
set ptr = random(count(gTraningArry5))
set wline = getAt(gTraningArry5,ptr)
set badword = item 2 of line wline of gWorkTable
if qword <> badword then
add arry1,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add arry1,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add arry1,item 2 of line wline of gWorkTable --ノXノyノã
add arry1,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
set cnt = cnt + 1
if cnt > (linecnt*3) then exit repeat
end if
deleteAt(gTraningArry5,ptr)
end repeat
set arry2 = []
set cnt = 1
repeat while 1
set pos = (cnt-1) * 4 + 3
set qword = line pos of traning
set ptr = random(count(gTraningArry5))
set wline = getAt(gTraningArry5,ptr)
set badword = item 2 of line wline of gWorkTable
if qword <> badword then
-- add arry2,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add arry2,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
-- add arry2,item 2 of line wline of gWorkTable --ノXノyノã
-- add arry2,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
set cnt = cnt + 1
if cnt > (linecnt*4) then exit repeat
end if
deleteAt(gTraningArry5,ptr)
end repeat
set arry2ptr = 1
set arry = []
repeat with i=1 to count(arry1)
if (i mod 4) = 2 then
add arry,getAt(arry2,arry2ptr)
set arry2ptr = arry2ptr + 1
else
add arry,getAt(arry1,i)
end if
end repeat
put the timer
return arry
end
--*****************************************************
--ナ@ナ@犇ヌ「ノgノ蠻[ノjノìノOノ菲Xノg醯êィナiノVノノノhノEナj
--************************************************
on GetBadShadowWords user,country
set the itemDelimiter = numtoChar(9)
OpenMaster()
set cnt = the number of lines in gWorkTable
set gTraningArry6 = []
repeat with i=1 to cnt
if char 6 of item 8 of line i of gWorkTable = "1" then
add gTraningArry6,i
end if
end repeat
set fname = GetFIleName(user,country,6)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノgノ蠻[ノjノìノOノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set traning = fcRead()
fcClose()
set arry = []
set linecnt = the number of lines in traning / 4
set cnt = 1
repeat while 1
set pos = (cnt-1) * 4 + 3
set qword = line pos of traning
set ptr = random(count(gTraningArry6))
set wline = getAt(gTraningArry6,ptr)
set badword = item 2 of line wline of gWorkTable
if qword <> badword then
add arry,item 7 of line wline of gWorkTable --í ヌオî醍ワ
add arry,PrintUsing(item 1 of line wline of gWorkTable) --â™î醍ワ
add arry,item 2 of line wline of gWorkTable --ノXノyノã
add arry,item 3 of line wline of gWorkTable --ìイñ{袁ñロ
set cnt = cnt + 1
if cnt > (linecnt*4) then exit repeat
end if
deleteAt(gTraningArry6,ptr)
end repeat
return arry
end
--*****************************************************
--ナ@ナ@ñろヒ鯡ìæ
--********************************
on GetWords user,country,traning
set fname = GetFIleName(user,country,traning)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノgノ蠻[ノjノìノOノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set arry = StringToArry(fcRead())
fcClose()
return arry
end
--*****************************************************
--ナ@ナ@裙笄鯡ìæ
--********************************
on GetResult user,country,traning
set arry =[]
set fname = GetFIleName(user,country,traning) & "RES"
set res = fcOpenR(fname)
if res <> 0 then
return arry
exit
end if
set arry = StringToArry(fcRead())
fcClose()
return arry
end
--*****************************************************
--ナ@ナ@裙笄ï\ëð
--********************************
on SetResult user,country,traning,arry
set fname = GetFIleName(user,country,traning) & "RES"
set res = fcOpen(fname)
if res <> 0 then
alert "ノIナ[ノvノìノGノ簀["
exit
end if
set res = fcWrite(ArryToString(arry))
fcClose()
end
--*****************************************************
--ナ@ナ@裙笄鯡ì貲iëSíP袁ナj
--********************************
on GetResultAll user
set arry = []
set codearry = []
set sortarry = []
set resarry = []
set wk = ""
set buf = ""
repeat with country = 1 to 6
repeat with traning = 1 to 6
set fname = GetFIleName(user,country,traning)
set res = fcOpenR(fname)
if res <> 0 then
alert "ノgノ蠻[ノjノìノOノtノ@ノCノ翩夘嵒ャヌゥヌヒヌ局™ヌメ"
exit
end if
set wk = fcRead()
fcClose()
set fname = GetFIleName(user,country,traning) & "RES"
set res = fcOpenR(fname)
if res = 0 then
if length(buf) <> 0 then set buf = buf & numToChar(13)
set buf = buf & fcRead()
fcClose()
else
end if
if traning = 1 then
repeat with i=1 to the number of lines in wk
if (i mod 3) = 1 then
add codearry,value(line i of wk)
add sortarry,value(line i of wk)
end if
end repeat
else if traning = 4 then
repeat with i=1 to the number of lines in wk
if (i mod 5) = 1 then
add codearry,value(line i of wk)
add sortarry,value(line i of wk)
end if
end repeat
else
repeat with i=1 to the number of lines in wk
if (i mod 4) = 1 then
add codearry,value(line i of wk)
add sortarry,value(line i of wk)
end if
end repeat
end if
end repeat
end repeat
set resarry = StringToArry(buf)
sort(sortarry)
repeat with i=1 to count(codearry)
add arry, "3"
end repeat
repeat with i=1 to count(codearry)
set code = getAt(codearry,i)
set pos = findPos(sortarry,code)
setAt( arry, pos, GetAt(resarry,i))
end repeat
return arry
end
--*****************************************************
--ナ@ナ@ノワナ[ノUナ[勒ïメ鯡ìæ
--********************************
on GetUserInfo user
set arry = []
set fname = path() & "USER" & string(user) & delimita() & "USER" & string(user)
set res = fcOpenR(fname)
if res <> 0 then
return arry
exit
end if
set arry = StringToArry(fcRead())
fcClose()
return arry
end
--*****************************************************
--ナ@ナ@ノワナ[ノUナ[勒ïメï\ëð
--********************************
on SetUserInfo user,arry
set fname = path() & "USER" & string(user) & delimita() & "USER" & string(user)
set res = fcOpen(fname)
if res <> 0 then
alert "ノワナ[ノUナ[ノtノ@ノCノ翹Iナ[ノvノìノGノ簀["
exit
end if
set res = fcWrite(ArryToString(arry))
fcClose()
end
--*****************************************************
--ナ@ナ@鬩鯆ノgノ衙fナ[ノ^
--********************************
on IndTraning user,traning,qcnt
set the itemDelimiter = numtoChar(9)
OpenMaster()
set gTraningArry1 = []
set gTraningArry2 = []
set gTraningArry3 = []
set gTraningArry4 = []
set gTraningArry5 = []
set gTraningArry6 = []
repeat while 1
set ptr = random(the number of lines in gWorkTable )
set flag = char traning of item 8 of line ptr of gWorkTable
if flag = "1" then
DevideWord(traning,ptr)
set qcnt = qcnt - 1
if qcnt = 0 then exit repeat
end if
delete line ptr of gWorkTable
end repeat
DataWrite(user,"TRE",traning)
case traning of
1: return gTraningArry1
2: return gTraningArry2
3: return gTraningArry3
4: return gTraningArry4
5: return gTraningArry5
6: return gTraningArry6
end case
end
--*****************************************************
--ナ@ナ@îópノfナ[ノ^鯡ìæ
--********************************
on GetCustomData user,fname
set arry = []
set fname = path() & "USER" & string(user) & delimita() & fname
set res = fcOpenR(fname)
if res <> 0 then
return arry
exit
end if
set arry = StringToArry(fcRead())
fcClose()
return arry
end
--*****************************************************
--ナ@ナ@îópノfナ[ノ^ï\ëð
--********************************
on SetCustomData user,arry,fname
set fname = path() & "USER" & string(user) & delimita() & fname
set res = fcOpen(fname)
if res <> 0 then
alert "îópノtノ@ノCノ翹Iナ[ノvノìノGノ簀["
exit
end if
set res = fcWrite(ArryToString(arry))
fcClose()
end